import { request } from '@/plugins/http';

export const apiUploadImage = (
  file: File,
  params?: any,
  onUploadProgress?: (progressEvent: any) => void,
) => {
  const fd = new FormData();
  fd.append('file', file);
  if (params) {
    for (let k in params) {
      fd.append(k, params[k]);
    }
  }
  return request('admin/upload/image', {
    method: 'POST',
    data: fd,
    onUploadProgress,
  });
};
